<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>tab</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<style>
    *{
        margin: 0;
        padding: 0;
    }

    #app {
        margin-left: 5px;
        border: solid 1px cornflowerblue;
        width: auto;

    }

    .title {

        width: 306px;
        height: 30px;
        border: 1px;
        border-radius: 1px;
        background: lightblue;
    }

    .title li {
        cursor: pointer;
        text-align: center;
        width: 100px;
        height: 100%;
        line-height: 30px;
        border-left: solid 1px white;
        display: inline-block;
        float: left;
    }
    .active{
        background: blueviolet;
        color: white;
    }


    .img {
        width: 300px;

    }
</style>
<div id="app">
    <ul class="title">
        <li v-for="(item ,index) in lists" v-bind:class="index==current?'active':''" v-on:click="handle(index)" :key="index">{{item.title}}</li>
    </ul>

    <div class="img" v-for="(item,index) in lists" v-show="index == current">
        <img :src="item.src">
    </div>
</div>
<script type="text/javascript">
    new Vue({
        el: '#app',
        data: {
            current:0,
            lists: [
                {
                    id:0,
                    title: 'orange',
                    src: 'img/orange.jpg'
                },
                {
                    id:1,
                    title: 'pear',
                    src: 'img/pear.jpg'
                },
                {
                    id:2,
                    title: 'water',
                    src: 'img/water.jpg'
                }],
        },
        methods:{
            handle:function(index){
                this.current=index;
            }
        }
    })
</script>

</body>
</html>